// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using System.Threading;
using System;
using System.Data.Common;

namespace SnapObjects.Data
{
    public interface IAdoDbProvider
    {
        IAdoDbResultSet<TElement> ExecuteSqlQuery<TElement>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior = CommandBehavior.Default);

        Task<IAdoDbResultSet<TElement>> ExecuteSqlQueryAsync<TElement>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        Task<IAdoDbResultSet<TElement>> ExecuteSqlQueryAsync<TElement>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior,
            CancellationToken cancellationToken = default);

        IAdoDbResultSet<TElement> ExecuteSqlProcedure<TElement>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior = CommandBehavior.Default);

        Task<IAdoDbResultSet<TElement>> ExecuteSqlProcedureAsync<TElement>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        Task<IAdoDbResultSet<TElement>> ExecuteSqlProcedureAsync<TElement>(
          string sqlText,
          IEnumerable<IAdoDbParameter> parameters,
          CommandBehavior commandBehavior,
          CancellationToken cancellationToken = default);

        int ExecuteSqlCommand(string sqlText, IEnumerable<IAdoDbParameter> parameters);

        Task<int> ExecuteSqlCommandAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        int ExecuteSqlProcedureCommand(string sqlText, IEnumerable<IAdoDbParameter> parameters);

        Task<int> ExecuteSqlProcedureCommandAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        TValue ExecuteSqlScalar<TValue>(string sqlText, IEnumerable<IAdoDbParameter> parameters);

        Task<TValue> ExecuteSqlScalarAsync<TValue>(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        IAdoDbDataVisitor ExecuteSqlQuery(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior = CommandBehavior.Default);

        Task<IAdoDbDataVisitor> ExecuteSqlQueryAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        Task<IAdoDbDataVisitor> ExecuteSqlQueryAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior,
            CancellationToken cancellationToken = default);

        IAdoDbDataVisitor ExecuteSqlProcedure(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CommandBehavior commandBehavior = CommandBehavior.Default);

        Task<IAdoDbDataVisitor> ExecuteSqlProcedureAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);

        Task<IAdoDbDataVisitor> ExecuteSqlProcedureAsync(
             string sqlText,
             IEnumerable<IAdoDbParameter> parameters,
             CommandBehavior commandBehavior,
             CancellationToken cancellationToken = default);

        void ExecuteSqlValidation(
            string sqlText, IEnumerable<IAdoDbParameter> parameters);

        Task ExecuteSqlValidationAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken = default);
    }
}
